{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Importing PulP solver\n",
    "from pulp import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Demand points\n",
    "demand_points=['Port of Mersin','Port of Jebel Ali']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Port of Mersin', 'Port of Jebel Ali']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "demand_points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Supply Points\n",
    "supply_points=['Port of Santos','Port of Montreal','Port of Vancouver','Port of Shanghai','Port of Marseille','Port of Bandar Abbas','Port of Haifa','Port of Aktau','Port of Busan','Penang Port','Port of Oslo','Port of Vladivostok','Port of Novorossiysk','Port of St. Petersburg','Port of Belgrade','Port of Mersin','Port of Odessa','Port of New York','Port of Los Angeles']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['Port of Santos',\n",
       " 'Port of Montreal',\n",
       " 'Port of Vancouver',\n",
       " 'Port of Shanghai',\n",
       " 'Port of Marseille',\n",
       " 'Port of Bandar Abbas',\n",
       " 'Port of Haifa',\n",
       " 'Port of Aktau',\n",
       " 'Port of Busan',\n",
       " 'Penang Port',\n",
       " 'Port of Oslo',\n",
       " 'Port of Vladivostok',\n",
       " 'Port of Novorossiysk',\n",
       " 'Port of St. Petersburg',\n",
       " 'Port of Belgrade',\n",
       " 'Port of Mersin',\n",
       " 'Port of Odessa',\n",
       " 'Port of New York',\n",
       " 'Port of Los Angeles']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "supply_points"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the distances\n",
    "distance = dict(zip(supply_points,[dict(zip(demand_points, [7528,9407])),\n",
    "dict(zip(demand_points, [6195,9470])),\n",
    "dict(zip(demand_points, [12320,10440])),\n",
    "dict(zip(demand_points, [8546,6627])),\n",
    "dict(zip(demand_points, [1806,5080])),\n",
    "dict(zip(demand_points, [3520,173])),\n",
    "dict(zip(demand_points, [233,3366])),\n",
    "dict(zip(demand_points, [2174,5094])),\n",
    "dict(zip(demand_points, [9062,7143])),\n",
    "dict(zip(demand_points, [5520,3601])),\n",
    "dict(zip(demand_points, [10049,7673])),\n",
    "dict(zip(demand_points, [9645,7727])),\n",
    "dict(zip(demand_points, [1552,4885])),\n",
    "dict(zip(demand_points, [5258,8532])),\n",
    "dict(zip(demand_points, [1829,5162])),\n",
    "dict(zip(demand_points, [0,3576])),\n",
    "dict(zip(demand_points, [1370,4703])),\n",
    "dict(zip(demand_points, [5617,8918])),\n",
    "dict(zip(demand_points, [11024,11116]))]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Santos': {'Port of Mersin': 7528, 'Port of Jebel Ali': 9407},\n",
       " 'Port of Montreal': {'Port of Mersin': 6195, 'Port of Jebel Ali': 9470},\n",
       " 'Port of Vancouver': {'Port of Mersin': 12320, 'Port of Jebel Ali': 10440},\n",
       " 'Port of Shanghai': {'Port of Mersin': 8546, 'Port of Jebel Ali': 6627},\n",
       " 'Port of Marseille': {'Port of Mersin': 1806, 'Port of Jebel Ali': 5080},\n",
       " 'Port of Bandar Abbas': {'Port of Mersin': 3520, 'Port of Jebel Ali': 173},\n",
       " 'Port of Haifa': {'Port of Mersin': 233, 'Port of Jebel Ali': 3366},\n",
       " 'Port of Aktau': {'Port of Mersin': 2174, 'Port of Jebel Ali': 5094},\n",
       " 'Port of Busan': {'Port of Mersin': 9062, 'Port of Jebel Ali': 7143},\n",
       " 'Penang Port': {'Port of Mersin': 5520, 'Port of Jebel Ali': 3601},\n",
       " 'Port of Oslo': {'Port of Mersin': 10049, 'Port of Jebel Ali': 7673},\n",
       " 'Port of Vladivostok': {'Port of Mersin': 9645, 'Port of Jebel Ali': 7727},\n",
       " 'Port of Novorossiysk': {'Port of Mersin': 1552, 'Port of Jebel Ali': 4885},\n",
       " 'Port of St. Petersburg': {'Port of Mersin': 5258, 'Port of Jebel Ali': 8532},\n",
       " 'Port of Belgrade': {'Port of Mersin': 1829, 'Port of Jebel Ali': 5162},\n",
       " 'Port of Mersin': {'Port of Mersin': 0, 'Port of Jebel Ali': 3576},\n",
       " 'Port of Odessa': {'Port of Mersin': 1370, 'Port of Jebel Ali': 4703},\n",
       " 'Port of New York': {'Port of Mersin': 5617, 'Port of Jebel Ali': 8918},\n",
       " 'Port of Los Angeles': {'Port of Mersin': 11024, 'Port of Jebel Ali': 11116}}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "distance"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Magnesium Demand\n",
    "magnesium_demand=dict(zip(demand_points, [191353978.2,220033911.8]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Mersin': 191353978.2, 'Port of Jebel Ali': 220033911.8}"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "magnesium_demand"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "#Inputing the Magnesium Supply\n",
    "magnesium_supply=dict(zip(supply_points, [4204466.2090,1222172.6320,363811.2924,298590444.7000,2010234.6250,1585983.9250,7566106.3450,6113002.8630,4078244.4230,47579.5177,5189339.4020,9195220.1200,4484984.5940,4536578.4990,379084.0981,3324539.5030,41313949.6100,10124868.6300,7057279.1490])) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Santos': 4204466.209,\n",
       " 'Port of Montreal': 1222172.632,\n",
       " 'Port of Vancouver': 363811.2924,\n",
       " 'Port of Shanghai': 298590444.7,\n",
       " 'Port of Marseille': 2010234.625,\n",
       " 'Port of Bandar Abbas': 1585983.925,\n",
       " 'Port of Haifa': 7566106.345,\n",
       " 'Port of Aktau': 6113002.863,\n",
       " 'Port of Busan': 4078244.423,\n",
       " 'Penang Port': 47579.5177,\n",
       " 'Port of Oslo': 5189339.402,\n",
       " 'Port of Vladivostok': 9195220.12,\n",
       " 'Port of Novorossiysk': 4484984.594,\n",
       " 'Port of St. Petersburg': 4536578.499,\n",
       " 'Port of Belgrade': 379084.0981,\n",
       " 'Port of Mersin': 3324539.503,\n",
       " 'Port of Odessa': 41313949.61,\n",
       " 'Port of New York': 10124868.63,\n",
       " 'Port of Los Angeles': 7057279.149}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "magnesium_supply"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set Problem Variables\n",
    "prob = LpProblem(\"Transportation\", LpMinimize)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "None\n",
       "VARIABLES"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set Problem Variables\n",
    "routes = [(i,j) for i in supply_points for j in demand_points]\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[('Port of Santos', 'Port of Mersin'),\n",
       " ('Port of Santos', 'Port of Jebel Ali'),\n",
       " ('Port of Montreal', 'Port of Mersin'),\n",
       " ('Port of Montreal', 'Port of Jebel Ali'),\n",
       " ('Port of Vancouver', 'Port of Mersin'),\n",
       " ('Port of Vancouver', 'Port of Jebel Ali'),\n",
       " ('Port of Shanghai', 'Port of Mersin'),\n",
       " ('Port of Shanghai', 'Port of Jebel Ali'),\n",
       " ('Port of Marseille', 'Port of Mersin'),\n",
       " ('Port of Marseille', 'Port of Jebel Ali'),\n",
       " ('Port of Bandar Abbas', 'Port of Mersin'),\n",
       " ('Port of Bandar Abbas', 'Port of Jebel Ali'),\n",
       " ('Port of Haifa', 'Port of Mersin'),\n",
       " ('Port of Haifa', 'Port of Jebel Ali'),\n",
       " ('Port of Aktau', 'Port of Mersin'),\n",
       " ('Port of Aktau', 'Port of Jebel Ali'),\n",
       " ('Port of Busan', 'Port of Mersin'),\n",
       " ('Port of Busan', 'Port of Jebel Ali'),\n",
       " ('Penang Port', 'Port of Mersin'),\n",
       " ('Penang Port', 'Port of Jebel Ali'),\n",
       " ('Port of Oslo', 'Port of Mersin'),\n",
       " ('Port of Oslo', 'Port of Jebel Ali'),\n",
       " ('Port of Vladivostok', 'Port of Mersin'),\n",
       " ('Port of Vladivostok', 'Port of Jebel Ali'),\n",
       " ('Port of Novorossiysk', 'Port of Mersin'),\n",
       " ('Port of Novorossiysk', 'Port of Jebel Ali'),\n",
       " ('Port of St. Petersburg', 'Port of Mersin'),\n",
       " ('Port of St. Petersburg', 'Port of Jebel Ali'),\n",
       " ('Port of Belgrade', 'Port of Mersin'),\n",
       " ('Port of Belgrade', 'Port of Jebel Ali'),\n",
       " ('Port of Mersin', 'Port of Mersin'),\n",
       " ('Port of Mersin', 'Port of Jebel Ali'),\n",
       " ('Port of Odessa', 'Port of Mersin'),\n",
       " ('Port of Odessa', 'Port of Jebel Ali'),\n",
       " ('Port of New York', 'Port of Mersin'),\n",
       " ('Port of New York', 'Port of Jebel Ali'),\n",
       " ('Port of Los Angeles', 'Port of Mersin'),\n",
       " ('Port of Los Angeles', 'Port of Jebel Ali')]"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "routes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Decision Variables\n",
    "X = LpVariable.dicts(\"ShipmentAmount\",(supply_points, demand_points),0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'Port of Santos': {'Port of Mersin': ShipmentAmount_Port_of_Santos_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali},\n",
       " 'Port of Montreal': {'Port of Mersin': ShipmentAmount_Port_of_Montreal_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali},\n",
       " 'Port of Vancouver': {'Port of Mersin': ShipmentAmount_Port_of_Vancouver_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali},\n",
       " 'Port of Shanghai': {'Port of Mersin': ShipmentAmount_Port_of_Shanghai_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali},\n",
       " 'Port of Marseille': {'Port of Mersin': ShipmentAmount_Port_of_Marseille_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali},\n",
       " 'Port of Bandar Abbas': {'Port of Mersin': ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali},\n",
       " 'Port of Haifa': {'Port of Mersin': ShipmentAmount_Port_of_Haifa_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali},\n",
       " 'Port of Aktau': {'Port of Mersin': ShipmentAmount_Port_of_Aktau_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali},\n",
       " 'Port of Busan': {'Port of Mersin': ShipmentAmount_Port_of_Busan_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali},\n",
       " 'Penang Port': {'Port of Mersin': ShipmentAmount_Penang_Port_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Penang_Port_Port_of_Jebel_Ali},\n",
       " 'Port of Oslo': {'Port of Mersin': ShipmentAmount_Port_of_Oslo_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali},\n",
       " 'Port of Vladivostok': {'Port of Mersin': ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali},\n",
       " 'Port of Novorossiysk': {'Port of Mersin': ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali},\n",
       " 'Port of St. Petersburg': {'Port of Mersin': ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali},\n",
       " 'Port of Belgrade': {'Port of Mersin': ShipmentAmount_Port_of_Belgrade_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali},\n",
       " 'Port of Mersin': {'Port of Mersin': ShipmentAmount_Port_of_Mersin_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali},\n",
       " 'Port of Odessa': {'Port of Mersin': ShipmentAmount_Port_of_Odessa_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali},\n",
       " 'Port of New York': {'Port of Mersin': ShipmentAmount_Port_of_New_York_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali},\n",
       " 'Port of Los Angeles': {'Port of Mersin': ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin,\n",
       "  'Port of Jebel Ali': ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali}}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Objective Function\n",
    "prob += sum(X[i][j]*distance[i][j] for (i,j) in routes)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "3601*ShipmentAmount_Penang_Port_Port_of_Jebel_Ali + 5520*ShipmentAmount_Penang_Port_Port_of_Mersin + 5094*ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali + 2174*ShipmentAmount_Port_of_Aktau_Port_of_Mersin + 173*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali + 3520*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin + 5162*ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali + 1829*ShipmentAmount_Port_of_Belgrade_Port_of_Mersin + 7143*ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali + 9062*ShipmentAmount_Port_of_Busan_Port_of_Mersin + 3366*ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali + 233*ShipmentAmount_Port_of_Haifa_Port_of_Mersin + 11116*ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali + 11024*ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin + 5080*ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali + 1806*ShipmentAmount_Port_of_Marseille_Port_of_Mersin + 3576*ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali + 9470*ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali + 6195*ShipmentAmount_Port_of_Montreal_Port_of_Mersin + 8918*ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali + 5617*ShipmentAmount_Port_of_New_York_Port_of_Mersin + 4885*ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali + 1552*ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin + 4703*ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali + 1370*ShipmentAmount_Port_of_Odessa_Port_of_Mersin + 7673*ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali + 10049*ShipmentAmount_Port_of_Oslo_Port_of_Mersin + 9407*ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali + 7528*ShipmentAmount_Port_of_Santos_Port_of_Mersin + 6627*ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali + 8546*ShipmentAmount_Port_of_Shanghai_Port_of_Mersin + 8532*ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali + 5258*ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin + 10440*ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali + 12320*ShipmentAmount_Port_of_Vancouver_Port_of_Mersin + 7727*ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali + 9645*ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin + 0\n",
       "VARIABLES\n",
       "ShipmentAmount_Penang_Port_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Penang_Port_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin Continuous"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "3601*ShipmentAmount_Penang_Port_Port_of_Jebel_Ali + 5520*ShipmentAmount_Penang_Port_Port_of_Mersin + 5094*ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali + 2174*ShipmentAmount_Port_of_Aktau_Port_of_Mersin + 173*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali + 3520*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin + 5162*ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali + 1829*ShipmentAmount_Port_of_Belgrade_Port_of_Mersin + 7143*ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali + 9062*ShipmentAmount_Port_of_Busan_Port_of_Mersin + 3366*ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali + 233*ShipmentAmount_Port_of_Haifa_Port_of_Mersin + 11116*ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali + 11024*ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin + 5080*ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali + 1806*ShipmentAmount_Port_of_Marseille_Port_of_Mersin + 3576*ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali + 9470*ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali + 6195*ShipmentAmount_Port_of_Montreal_Port_of_Mersin + 8918*ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali + 5617*ShipmentAmount_Port_of_New_York_Port_of_Mersin + 4885*ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali + 1552*ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin + 4703*ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali + 1370*ShipmentAmount_Port_of_Odessa_Port_of_Mersin + 7673*ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali + 10049*ShipmentAmount_Port_of_Oslo_Port_of_Mersin + 9407*ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali + 7528*ShipmentAmount_Port_of_Santos_Port_of_Mersin + 6627*ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali + 8546*ShipmentAmount_Port_of_Shanghai_Port_of_Mersin + 8532*ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali + 5258*ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin + 10440*ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali + 12320*ShipmentAmount_Port_of_Vancouver_Port_of_Mersin + 7727*ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali + 9645*ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin + 0\n",
       "SUBJECT TO\n",
       "_C1: ShipmentAmount_Penang_Port_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin >= 191353978.2\n",
       "\n",
       "_C2: ShipmentAmount_Penang_Port_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali >= 220033911.8\n",
       "\n",
       "VARIABLES\n",
       "ShipmentAmount_Penang_Port_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Penang_Port_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin Continuous"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Constraints\n",
    "for j in demand_points:\n",
    "    prob += sum(X[i][j] for i in supply_points) >= magnesium_demand[j]\n",
    "    \n",
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transportation:\n",
       "MINIMIZE\n",
       "3601*ShipmentAmount_Penang_Port_Port_of_Jebel_Ali + 5520*ShipmentAmount_Penang_Port_Port_of_Mersin + 5094*ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali + 2174*ShipmentAmount_Port_of_Aktau_Port_of_Mersin + 173*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali + 3520*ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin + 5162*ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali + 1829*ShipmentAmount_Port_of_Belgrade_Port_of_Mersin + 7143*ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali + 9062*ShipmentAmount_Port_of_Busan_Port_of_Mersin + 3366*ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali + 233*ShipmentAmount_Port_of_Haifa_Port_of_Mersin + 11116*ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali + 11024*ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin + 5080*ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali + 1806*ShipmentAmount_Port_of_Marseille_Port_of_Mersin + 3576*ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali + 9470*ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali + 6195*ShipmentAmount_Port_of_Montreal_Port_of_Mersin + 8918*ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali + 5617*ShipmentAmount_Port_of_New_York_Port_of_Mersin + 4885*ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali + 1552*ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin + 4703*ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali + 1370*ShipmentAmount_Port_of_Odessa_Port_of_Mersin + 7673*ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali + 10049*ShipmentAmount_Port_of_Oslo_Port_of_Mersin + 9407*ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali + 7528*ShipmentAmount_Port_of_Santos_Port_of_Mersin + 6627*ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali + 8546*ShipmentAmount_Port_of_Shanghai_Port_of_Mersin + 8532*ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali + 5258*ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin + 10440*ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali + 12320*ShipmentAmount_Port_of_Vancouver_Port_of_Mersin + 7727*ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali + 9645*ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin + 0\n",
       "SUBJECT TO\n",
       "_C1: ShipmentAmount_Penang_Port_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Mersin\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin >= 191353978.2\n",
       "\n",
       "_C2: ShipmentAmount_Penang_Port_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali >= 220033911.8\n",
       "\n",
       "_C3: ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Santos_Port_of_Mersin = 4204466.209\n",
       "\n",
       "_C4: ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Montreal_Port_of_Mersin = 1222172.632\n",
       "\n",
       "_C5: ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Vancouver_Port_of_Mersin = 363811.2924\n",
       "\n",
       "_C6: ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Shanghai_Port_of_Mersin = 298590444.7\n",
       "\n",
       "_C7: ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Marseille_Port_of_Mersin = 2010234.625\n",
       "\n",
       "_C8: ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin = 1585983.925\n",
       "\n",
       "_C9: ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Haifa_Port_of_Mersin = 7566106.345\n",
       "\n",
       "_C10: ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Aktau_Port_of_Mersin = 6113002.863\n",
       "\n",
       "_C11: ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Busan_Port_of_Mersin = 4078244.423\n",
       "\n",
       "_C12: ShipmentAmount_Penang_Port_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Penang_Port_Port_of_Mersin = 47579.5177\n",
       "\n",
       "_C13: ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Oslo_Port_of_Mersin = 5189339.402\n",
       "\n",
       "_C14: ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin = 9195220.12\n",
       "\n",
       "_C15: ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin = 4484984.594\n",
       "\n",
       "_C16: ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin = 4536578.499\n",
       "\n",
       "_C17: ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Belgrade_Port_of_Mersin = 379084.0981\n",
       "\n",
       "_C18: ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Mersin_Port_of_Mersin = 3324539.503\n",
       "\n",
       "_C19: ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Odessa_Port_of_Mersin = 41313949.61\n",
       "\n",
       "_C20: ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_New_York_Port_of_Mersin = 10124868.63\n",
       "\n",
       "_C21: ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali\n",
       " + ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin = 7057279.149\n",
       "\n",
       "VARIABLES\n",
       "ShipmentAmount_Penang_Port_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Penang_Port_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Aktau_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Belgrade_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Busan_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Haifa_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Marseille_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Mersin_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Montreal_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_New_York_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Odessa_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Oslo_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Santos_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Shanghai_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Vancouver_Port_of_Mersin Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Jebel_Ali Continuous\n",
       "ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin Continuous"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Constraints\n",
    "for i in supply_points:\n",
    "    prob += sum(X[i][j] for j in demand_points) == magnesium_supply[i]\n",
    "prob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Status: Optimal\n",
      "ShipmentAmount_Penang_Port_Port_of_Mersin = 47579.518\n",
      "ShipmentAmount_Port_of_Aktau_Port_of_Mersin = 6113002.9\n",
      "ShipmentAmount_Port_of_Bandar_Abbas_Port_of_Jebel_Ali = 1585983.9\n",
      "ShipmentAmount_Port_of_Belgrade_Port_of_Mersin = 379084.1\n",
      "ShipmentAmount_Port_of_Busan_Port_of_Mersin = 4078244.4\n",
      "ShipmentAmount_Port_of_Haifa_Port_of_Mersin = 7566106.3\n",
      "ShipmentAmount_Port_of_Los_Angeles_Port_of_Mersin = 7057279.1\n",
      "ShipmentAmount_Port_of_Marseille_Port_of_Mersin = 2010234.6\n",
      "ShipmentAmount_Port_of_Mersin_Port_of_Mersin = 3324539.5\n",
      "ShipmentAmount_Port_of_Montreal_Port_of_Mersin = 1222172.6\n",
      "ShipmentAmount_Port_of_New_York_Port_of_Mersin = 10124869.0\n",
      "ShipmentAmount_Port_of_Novorossiysk_Port_of_Mersin = 4484984.6\n",
      "ShipmentAmount_Port_of_Odessa_Port_of_Mersin = 41313950.0\n",
      "ShipmentAmount_Port_of_Oslo_Port_of_Jebel_Ali = 5189339.4\n",
      "ShipmentAmount_Port_of_Santos_Port_of_Mersin = 4204466.2\n",
      "ShipmentAmount_Port_of_Shanghai_Port_of_Jebel_Ali = 213258590.0\n",
      "ShipmentAmount_Port_of_Shanghai_Port_of_Mersin = 85331856.0\n",
      "ShipmentAmount_Port_of_St._Petersburg_Port_of_Mersin = 4536578.5\n",
      "ShipmentAmount_Port_of_Vancouver_Port_of_Mersin = 363811.29\n",
      "ShipmentAmount_Port_of_Vladivostok_Port_of_Mersin = 9195220.1\n",
      "Total kilogram_miles = 2593676588099.5596\n"
     ]
    }
   ],
   "source": [
    "prob.solve()\n",
    "\n",
    "print(\"Status:\", LpStatus[prob.status])\n",
    "\n",
    "for v in prob.variables():\n",
    "    if v.varValue > 0:\n",
    "        print(v.name, \"=\", v.varValue)\n",
    "\n",
    "print(\"Total kilogram_miles =\", value(prob.objective))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
